﻿package com.tudou.home.model
{
    import com.tudou.consts.*;
    import com.tudou.cookie.*;
    import com.tudou.home.consts.*;
    import com.tudou.home.utils.*;
    import com.tudou.model.*;
    import com.tudou.utils.*;

    public class PageInfo extends BaseInfo implements ITudouInfo
    {
        private var _nielsenStat:String = "0";
        private var _soJuid:String = "";
        private var _comScoreC6:String = "";
        private var _skipTailValue:Number = -1;
        private var _title:String;
        public var firstFinish:Boolean;
        private var _areaCode:int = 0;
        private var _forcejuid:Boolean = false;
        public var isUserOwner:Boolean;
        private var _skipHeadValue:Number = -1;
        private var _playCount:int;
        public var password:String = "";
        private var _expandStage:Boolean;
        private var _commentCount:int;
        public var urlParams:TudouURL;
        private var pageInfo:Object;
        private var _changeItemManual:Boolean = false;
        private var _frame1URL:String;
        private var _lastCurPlayTimePos:Number = 0;
        private var _duration:String;
        private static var instance:PageInfo;

        public function PageInfo()
        {
            return;
        }// end function

        public function set channelId(param1:int) : void
        {
            _channelId = param1;
            return;
        }// end function

        public function set expandStage(param1:Boolean) : void
        {
            _expandStage = param1;
            return;
        }// end function

        public function set isToll(param1:Boolean) : void
        {
            _isToll = param1;
            return;
        }// end function

        public function set changeItemManual(param1:Boolean) : void
        {
            _changeItemManual = param1;
            return;
        }// end function

        public function set lastCurPlayTime(param1:Number) : void
        {
            _lastCurPlayTime = param1;
            return;
        }// end function

        public function set currRateType(param1:int) : void
        {
            _currRateType = param1;
            return;
        }// end function

        public function get areaCode() : int
        {
            return _areaCode;
        }// end function

        public function get ID() : String
        {
            return pageInfo["ID"];
        }// end function

        public function get debugURL() : String
        {
            return pageInfo["vurl"];
        }// end function

        public function get soJuid() : String
        {
            return _soJuid;
        }// end function

        public function collect(param1:Object, param2:String) : void
        {
            var _loc_3:* = param2;
            _loc_3 = _loc_3.split("?").shift();
            _loc_3 = _loc_3.split("/").pop();
            _playerName = _loc_3;
            pageInfo = param1;
            if (pageInfo["lid"] != null && pageInfo["lid"] != 0)
            {
                _sourceId = "10000";
                _isListPlayer = true;
            }
            else
            {
                _sourceId = "11000";
                _isListPlayer = false;
            }
            _adSourceId = _sourceId;
            if (pageInfo["adSourceId"])
            {
                _adSourceId = pageInfo["adSourceId"];
            }
            _userId = pageInfo["uid"];
            _juid = pageInfo["juid"];
            _lid = pageInfo["lid"];
            _aid = pageInfo["aid"];
            _userAgent = pageInfo["USER_AGENT"];
            _refferURL = pageInfo["referrer"];
            _href = pageInfo["href"];
            _channelId = pageInfo["channel"];
            _isRec = pageInfo["isRec"];
            _iid = pageInfo["iid"];
            _isPrivate = pageInfo["np"] == "1";
            _isToll = pageInfo["nm"] == "1";
            _needCount = pageInfo["nc"] == "1";
            _comScoreC6 = pageInfo["csc6"];
            _nielsenStat = pageInfo["nls"];
            _original = pageInfo["ol"] == "1";
            _originalWidth = pageInfo["olw"];
            _originalHeight = pageInfo["olh"];
            _originalRate = pageInfo["olr"];
            skipHeadValue = pageInfo["sh"];
            skipTailValue = pageInfo["st"];
            _maxRateType = int(pageInfo["hd"]);
            if (_maxRateType > RateType.P720)
            {
                _maxRateType = RateType.P720;
            }
            if (_maxRateType < RateType.P256)
            {
                _maxRateType = RateType.P256;
            }
            _expandStage = pageInfo["scale"] == "1";
            _frame1URL = pageInfo["frame1"];
            _title = pageInfo["title"];
            processHref();
            PlayerConsts.HAS_HARD_WORK = pageInfo["hw"] == "1";
            firstFinish = true;
            isUserOwner = pageInfo["ban"] == "1";
            _seid = pageInfo["seid"];
            _rurlId = pageInfo["rurlstr"];
            lastCurPlayTime = -1;
            videoTotalTime = int(pageInfo["time"]);
            var _loc_4:* = int(pageInfo["wtime"]);
            if (videoTotalTime > 0)
            {
                if (_loc_4 > 0)
                {
                    lastCurPlayTime = _loc_4;
                }
                lastCurPlayTimePos = lastCurPlayTime / videoTotalTime;
            }
            _forcejuid = pageInfo["forcejuid"] == "1";
            var _loc_5:* = pageInfo["testjuid"];
            if (!_forcejuid)
            {
                _soJuid = PlayerSO.getInst().juid;
                if (!_soJuid)
                {
                    _soJuid = _loc_5;
                    PlayerSO.getInst().juid = _soJuid;
                }
            }
            else
            {
                _soJuid = _loc_5;
                PlayerSO.getInst().juid = _soJuid;
            }
            if (!_soJuid)
            {
                _soJuid = "1";
            }
            _rinfo = pageInfo["rinfo"];
            _resourceId = pageInfo["resourceId"];
            return;
        }// end function

        public function get isNielson() : int
        {
            return pageInfo["isNielson"];
        }// end function

        public function set areaCode(param1:int) : void
        {
            _areaCode = param1;
            return;
        }// end function

        public function updateCvid() : void
        {
            _cvid = RandString.randIntId;
            return;
        }// end function

        public function set needCount(param1:Boolean) : void
        {
            _needCount = param1;
            return;
        }// end function

        private function processHref() : void
        {
            urlParams = new TudouURL(href);
            return;
        }// end function

        public function set comScoreC6(param1:String) : void
        {
            _comScoreC6 = param1 == "0" ? ("") : (param1);
            return;
        }// end function

        public function get skipTailValue() : Number
        {
            return _skipTailValue;
        }// end function

        public function get playRate() : int
        {
            return pageInfo["phd"];
        }// end function

        public function reset() : void
        {
            _changeItemManual = false;
            _lastCurPlayTime = -1;
            _lastCurPlayTimePos = -1;
            return;
        }// end function

        public function get lastCurPlayTimePos() : Number
        {
            return _lastCurPlayTimePos;
        }// end function

        public function set pvid(param1:String) : void
        {
            _pvid = param1;
            return;
        }// end function

        public function get playCount() : int
        {
            return _playCount;
        }// end function

        public function get title() : String
        {
            return _title;
        }// end function

        public function set skipHeadValue(param1:Number) : void
        {
            _skipHeadValue = MathUtil.unit(param1);
            return;
        }// end function

        public function get frame1URL() : String
        {
            return _frame1URL;
        }// end function

        public function set isForceBand(param1:Boolean) : void
        {
            _isForceBand = param1;
            return;
        }// end function

        public function set rurlId(param1:String) : void
        {
            _rurlId = param1;
            return;
        }// end function

        public function set maxRateType(param1:int) : void
        {
            _maxRateType = param1;
            return;
        }// end function

        public function set skipTailValue(param1:Number) : void
        {
            _skipTailValue = MathUtil.unit(param1);
            return;
        }// end function

        public function set iid(param1:int) : void
        {
            _iid = param1;
            return;
        }// end function

        public function get changeItemManual() : Boolean
        {
            return _changeItemManual;
        }// end function

        public function get adOwnerId() : String
        {
            return pageInfo["adOwnerId"];
        }// end function

        public function updateRid() : void
        {
            _rid = RandString.randId;
            return;
        }// end function

        public function get duration() : String
        {
            return _duration;
        }// end function

        public function set lastCurPlayTimePos(param1:Number) : void
        {
            _lastCurPlayTimePos = MathUtil.unit(param1);
            return;
        }// end function

        public function set originalRate(param1:Number) : void
        {
            _originalRate = param1;
            return;
        }// end function

        public function get comScoreC6() : String
        {
            return _comScoreC6;
        }// end function

        public function updatePpid() : void
        {
            _ppid = RandString.randId;
            return;
        }// end function

        public function get adPositionId() : String
        {
            return pageInfo["adPositionId"];
        }// end function

        public function set original(param1:Boolean) : void
        {
            _original = param1;
            return;
        }// end function

        public function set originalHeight(param1:int) : void
        {
            _originalHeight = param1;
            return;
        }// end function

        public function get expandStage() : Boolean
        {
            return _expandStage;
        }// end function

        public function set lastPlayTime(param1:Number) : void
        {
            _lastPlayTime = param1;
            return;
        }// end function

        public function set title(param1:String) : void
        {
            _title = param1;
            return;
        }// end function

        public function get skipHeadValue() : Number
        {
            return _skipHeadValue;
        }// end function

        public function get actionID() : String
        {
            return pageInfo["actionID"];
        }// end function

        public function set seid(param1:String) : void
        {
            _seid = param1;
            return;
        }// end function

        public function set nielsenStat(param1:String) : void
        {
            _nielsenStat = param1;
            return;
        }// end function

        public function set viewState(param1:int) : void
        {
            _viewState = param1;
            return;
        }// end function

        public function set originalWidth(param1:int) : void
        {
            _originalWidth = param1;
            return;
        }// end function

        public function get nielsenStat() : String
        {
            return _nielsenStat;
        }// end function

        public function get commentCount() : int
        {
            return _commentCount;
        }// end function

        public function set isPrivate(param1:Boolean) : void
        {
            _isPrivate = param1;
            return;
        }// end function

        public function set lastPlayIID(param1:int) : void
        {
            _lastPlayIID = param1;
            return;
        }// end function

        public function get skipHeadTail() : Boolean
        {
            return _skipHeadValue > 0 && _skipHeadValue < 1 || _skipTailValue > 0 && _skipTailValue < 1;
        }// end function

        public function set videoTotalTime(param1:Number) : void
        {
            _videoTotalTime = param1;
            return;
        }// end function

        public static function getInstance() : PageInfo
        {
            if (instance == null)
            {
                instance = new PageInfo;
            }
            return instance;
        }// end function

    }
}
